<template>
	<div class="register-container">
		<form>
			<input type="text" v-model="username" placeholder="用户名">
			<input type="password" v-model="password" placeholder="密码">
			<button @click="update">修改</button>
		</form>
	</div>
</template>

<script>
	export default {
		data() {
			return {
				username: '',
				password: ''
			};
		},
		methods: {
			async update() {
				if (this.username != "" && this.password != "") {
					const res = await this.$myRequest({
						url: 'user/register',
						method: 'POST',
						data: {
							id:1,
							username: this.username,
							password: this.password
						}
					})
					console.log(res);
					uni.switchTab({
						url:'/pages/my/my'
					})
				}
			}
		}
	};
</script>

<style>
	input {
		margin-top: 30px;
		border: solid;

		border-radius: 6rpx;
		width: 300px;
		height: 30px;
	}

	form {
		display: flex;
		flex-direction: column;
		align-items: center;
	}

	button {
		margin-top: 30px;
		padding: 10px 20px;
		background-color: #007aff;
		color: #ffffff;
		border: none;
		border-radius: 5px;
		cursor: pointer;
	}

	button:hover {
		background-color: #0055cc;
	}
</style>
